import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { ConfigProvider } from '../config/config';

/*
  Generated class for the CourseProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class CourseProvider {

  constructor(
    private http: HttpClient,
    private config:ConfigProvider) { }
    private getBookListUrl = this.config.HOST + "/public/getBookList"
    private getStudentListUrl = this.config.HOST + "/public/getStudentList"
    private getClassroomListUrl = this.config.HOST + "/public/getClassroomList"
    private getTeacherListUrl = this.config.HOST + "/public/getTeacherList"

    getBookList(){
     return this.http.get(this.getBookListUrl).toPromise();
    }
 
    getStudentList(){
      return this.http.get(this.getStudentListUrl).toPromise();
     }

    getClassroomList(){
      return this.http.get(this.getClassroomListUrl).toPromise();
     }

    getTeacherList(){
      return this.http.get(this.getTeacherListUrl).toPromise();
     }


    private getCourseListByParmUrl = this.config.HOST + "/public/getCourseListByParm"
    getCourseListByParm(key:string,value:string){
     let parm = {
           "key":key,
           "value":value
     }
     return this.http.post(this.getCourseListByParmUrl,parm).toPromise();
    }



}
